// 行为干预任务模型
export interface Task {
  id: string;
  type: 'diet' | 'exercise' | 'medication' | 'emotion'; // 任务类型：饮食、运动、药物依从性、情绪调节
  title: string;
  description: string;
  difficulty: 'easy' | 'medium' | 'hard';
  duration: number; // 持续时间（分钟）
  points: number; // 完成任务获得的积分
  icon?: string; // 任务图标
  frequency: 'daily' | 'weekly' | 'monthly';
  recommendedFor?: string[]; // 推荐的疾病类型
  createdAt: Date;
}

// 用户任务记录模型
export interface UserTask {
  id: string;
  taskId: string;
  userId: string;
  status: 'pending' | 'in_progress' | 'completed' | 'failed';
  assignedDate: Date;
  dueDate: Date;
  completedDate?: Date;
  progress: number; // 完成进度（0-100）
  notes?: string;
  pointsEarned?: number;
}

// 积分记录模型
export interface PointRecord {
  id: string;
  userId: string;
  points: number;
  type: 'task' | 'reward' | 'penalty';
  sourceId?: string; // 关联的任务ID或其他来源ID
  timestamp: Date;
  description: string;
}

// 用户积分账户模型
export interface PointAccount {
  userId: string;
  totalPoints: number;
  level: number;
  pointsHistory: PointRecord[];
  lastUpdated: Date;
}

// 任务统计模型
export interface TaskStatistics {
  userId: string;
  completedTasks: number;
  totalTasks: number;
  completionRate: number;
  pointsEarned: number;
  streakDays: number;
  lastCompletedDate?: Date;
  categoryStats: CategoryStat[];
}

// 分类统计模型
export interface CategoryStat {
  type: 'diet' | 'exercise' | 'medication' | 'emotion';
  completed: number;
  total: number;
  percentage: number;
}